import { getGameObjectById } from "../engine";
import { Behaviour } from "../engine/Behaviour";
import { Transform } from "../engine/Transform";
import { number } from "../engine/validators/number";
import { BillSystem } from "./BillSystem";
import { Display } from "./Display";

export class ShopActive extends Behaviour {

    onStart() {
        this.gameObject.onClick = () => {
             console.log(this.gameObject.id);
             if(this.gameObject.id=="UI_button_shop"){
                getGameObjectById('UI_Store').getBehaviour(Display).IsActive=true;
                getGameObjectById('UI_button_close').getBehaviour(Display).IsActive=true;
                getGameObjectById('UI_button_money_ChilliSauce').getBehaviour(Display).IsActive=true;
                getGameObjectById('UI_button_money_SunRong').getBehaviour(Display).IsActive=true;
                getGameObjectById('UI_button_money_Conghua').getBehaviour(Display).IsActive=true;
                getGameObjectById('UI_button_money_Bacon').getBehaviour(Display).IsActive=true;
                getGameObjectById('UI_button_money_Chicken').getBehaviour(Display).IsActive=true;
                getGameObjectById('UI_button_money_BJUTBox').getBehaviour(Display).IsActive=true;
                getGameObjectById('UI_Text_money_ChillSource').getBehaviour(Display).IsActive=true;
                getGameObjectById('UI_Text_money_SuanRong').getBehaviour(Display).IsActive=true;
                getGameObjectById('UI_Text_money_Conghua').getBehaviour(Display).IsActive=true;
                getGameObjectById('UI_Text_money_Bacon').getBehaviour(Display).IsActive=true;
                getGameObjectById('UI_Text_money_Chicken').getBehaviour(Display).IsActive=true;
                getGameObjectById('UI_Text_money_BJUTBox').getBehaviour(Display).IsActive=true;
                console.log("shopppp")
             }
             if(getGameObjectById('UI_button_money_ChilliSauce').getBehaviour(BillSystem).IsSold_ChilliSource==true){
                getGameObjectById('UI_button_moneyPurchased_ChilliSource').getBehaviour(Display).IsActive=true;
             }
             if(getGameObjectById('UI_button_money_SunRong').getBehaviour(BillSystem).IsSold_SuanRong==true){
                getGameObjectById('UI_button_moneyPurchased_SuanRong').getBehaviour(Display).IsActive=true;
             }
             if(getGameObjectById('UI_button_money_Conghua').getBehaviour(BillSystem).IsSold_CongHua==true){
                getGameObjectById('UI_button_moneyPurchased_CongHua').getBehaviour(Display).IsActive=true;
             }
             if(getGameObjectById('UI_button_money_Bacon').getBehaviour(BillSystem).IsSold_Bacon==true){
                getGameObjectById('UI_button_moneyPurchased_Bacon').getBehaviour(Display).IsActive=true;
             }
             if(getGameObjectById('UI_button_money_Chicken').getBehaviour(BillSystem).IsSold_Chicken==true){
                getGameObjectById('UI_button_moneyPurchased_Chicken').getBehaviour(Display).IsActive=true;
             }
             if(getGameObjectById('UI_button_money_BJUTBox').getBehaviour(BillSystem).IsSold_BJUTBox==true){
                getGameObjectById('UI_button_moneyPurchased_BJUTBox').getBehaviour(Display).IsActive=true;
             }

        };
    }

    onTick(duringTime: number) {

    }
}
